package mysql.entity;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import mysql.constant.PaymentStatus;
import org.hibernate.annotations.Cascade;

import javax.persistence.*;

@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
@Entity
@Table(name = "ORDERS")
public class Order extends BaseEntity {
    @Enumerated(EnumType.STRING)
    @Column(nullable = false)
    private PaymentStatus paymentStatus;

    @ManyToOne(cascade = {CascadeType.DETACH})
    @JoinColumn(name = "ORDER_USER_ID", referencedColumnName = "ID")
//    @Cascade(value = {org.hibernate.annotations.CascadeType.ALL})
    private User user;

//    @OneToOne(mappedBy = "order", cascade = {CascadeType.ALL})
////    @JoinColumn(name = "USER_ID", referencedColumnName = "ID")
//    private User user;
}
